import re

attr = 'someone@gmail.cn'
m = re.match(r'\w+@\w+\.(com|cn)', attr)
print(m)
attr2 = 'somneworld'
m2 = re.match(r'\w+', attr2)
print(m2)

attr3 = 'bill.gates@microsoft.com'
m3 = re.match(r'(.+)@\w+\.(com|cn)', attr3)
print(m3)
print(m3.group(1))
